*------------------------------------------------------------------------------*
		*** FIGURE S13. HISTOGRAM OF WITHIN-COUNTY STANDARD DEVIATION ***
*------------------------------------------------------------------------------*

use "${tempdata}kreise_complete_all.dta", clear

keep if samplePM10_allcontrols == 1

*------------------------------------------------------------------------------*

***Generate within sd
reg PM10_30km_10ug i.kreis_code i.election_date
predict res, r
egen sdw = sd(res), by(kreis_code)

***Generate within average
egen avw = mean(PM10_30km_10ug), by(kreis_code)

***Collapse
collapse sdw avw, by(kreis_code)

*------------------------------------------------------------------------------*

***Histogram of within sd
twoway (histogram sdw, fcolor(navy) lcolor(ltbluishgray%20) lwidth(vthin)) || ///
		(pcarrowi 0.5 1.36 0.2 1.36, color(black) text(0.55 1.36 "Frankfurt (Oder), Kreisfreie Stadt" ///
		"Oberspreewald-Lausitz, Landkreis" "Oder-Spree, Landkreis" "Passau" "Passau, Landkreis", place(n) size(vsmall))), ///
		xtitle(Within-county standard deviation of PM10 (10 {&mu}g/m{sup:3})) graphregion(fcolor(white)) legend(off)

graph export "${outputs}figure_S13.pdf", as(pdf) replace

*------------------------------------------------------------------------------*

clear

exit
